package com.wanxi.study;

public class ReturnMethod {
    public static void main(String[] args) {

        int[] array = {11, 22, 33, 44, 55, 66, 77};

        int max = maxArray(array);
        System.out.println(max);


    }

    public static void runArray(int [] array){
        int length = array.length;
        System.out.print("[");
        for (int i = 0; i < length; i++) {
        if(i!=length-1){
            System.out.print(array[i] + " ");
        }
        if(i==length-1){
                System.out.print(array[i] + "]");
            }
        }
    }



    public  static int maxArray(int [] array){
        int max = 0;
        int length = array.length;

        for (int i = 0; i < length; i++) {
            max= max>array[i]?max:array[i];
        }

        return max;

    }


}




